package com.rickpan.dto.request;

import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;

/**
 * 图片生成请求DTO
 */
public class ImageGenerationRequest {

    @NotBlank(message = "提示词不能为空")
    @Size(max = 2000, message = "提示词不能超过2000字符")
    private String prompt;

    @Size(max = 20, message = "图片尺寸格式不正确")
    private String imageSize = "1024x1024";

    @Min(value = 1, message = "生成数量至少为1")
    @Max(value = 4, message = "生成数量最多为4")
    private Integer batchSize = 1;

    @Min(value = 1, message = "推理步数至少为1")
    @Max(value = 50, message = "推理步数最多为50")
    private Integer numInferenceSteps = 20;

    @Min(value = 0, message = "引导强度不能小于0")
    @Max(value = 20, message = "引导强度不能大于20")
    private Double guidanceScale = 7.5;

    // 可选的参考图片（base64格式）
    private String image;

    // 标识这是图片生成请求
    private Boolean isImageGeneration = true;

    // 构造函数
    public ImageGenerationRequest() {}

    public ImageGenerationRequest(String prompt, String imageSize, Integer batchSize, 
                                Integer numInferenceSteps, Double guidanceScale) {
        this.prompt = prompt;
        this.imageSize = imageSize;
        this.batchSize = batchSize;
        this.numInferenceSteps = numInferenceSteps;
        this.guidanceScale = guidanceScale;
    }

    // Getter 和 Setter 方法
    public String getPrompt() {
        return prompt;
    }

    public void setPrompt(String prompt) {
        this.prompt = prompt;
    }

    public String getImageSize() {
        return imageSize;
    }

    public void setImageSize(String imageSize) {
        this.imageSize = imageSize;
    }

    public Integer getBatchSize() {
        return batchSize;
    }

    public void setBatchSize(Integer batchSize) {
        this.batchSize = batchSize;
    }

    public Integer getNumInferenceSteps() {
        return numInferenceSteps;
    }

    public void setNumInferenceSteps(Integer numInferenceSteps) {
        this.numInferenceSteps = numInferenceSteps;
    }

    public Double getGuidanceScale() {
        return guidanceScale;
    }

    public void setGuidanceScale(Double guidanceScale) {
        this.guidanceScale = guidanceScale;
    }

    public String getImage() {
        return image;
    }

    public void setImage(String image) {
        this.image = image;
    }

    public Boolean getIsImageGeneration() {
        return isImageGeneration;
    }

    public void setIsImageGeneration(Boolean isImageGeneration) {
        this.isImageGeneration = isImageGeneration;
    }

    @Override
    public String toString() {
        return "ImageGenerationRequest{" +
                "prompt='" + prompt + '\'' +
                ", imageSize='" + imageSize + '\'' +
                ", batchSize=" + batchSize +
                ", numInferenceSteps=" + numInferenceSteps +
                ", guidanceScale=" + guidanceScale +
                ", hasImage=" + (image != null && !image.isEmpty()) +
                ", isImageGeneration=" + isImageGeneration +
                '}';
    }
}
